/*
 * @Author: liu.lin liu.lin@hzleaper.com
 * @Date: 2023-11-16 19:28:55
 * @LastEditors: liu.lin liu.lin@hzleaper.com
 * @LastEditTime: 2023-11-24 10:26:56
 * @FilePath: \aoi_link_frontend\src\page\config\component\OnConfiguration\index.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { FC } from 'react';
import { UploadOutlined } from '@ant-design/icons';
import type { UploadProps } from 'antd';
import { Button, message, Upload } from 'antd';
import './index.less';

const props: UploadProps = {
  name: 'file',
  action: '/api/config/upload',
  headers: {
    authorization: 'authorization-text'
  },
  accept: '.xlsx',
  onChange(info) {
    if (info.file.status !== 'uploading') {
      console.log(info.file, info.fileList);
    }
    if (info.file.status === 'done') {
      message.success(`${info.file.name} file uploaded successfully`);
    } else if (info.file.status === 'error') {
      message.error(`${info.file.name} file upload failed.`);
    }
  }
};

const OnConfiguration: FC = () => {
  return (
    <div className="config_guration">
      <h1>过漏检明细配置</h1>
      <span className="config_guration_span">过漏检明细文档上传:</span>
      <Upload {...props}>
        <Button icon={<UploadOutlined />}>点击上传</Button>
      </Upload>
    </div>
  );
};
export default OnConfiguration;
